
angular.module("onlinedelivery.service", [])
    .factory('online_deliveryService',['$http',function($http){

        var service = {};

        //上线支付页面（可选部署包子页面）中下载某个产品对应的部署包到本地环境下，同时后台需下载历史记录保存到数据库中
        service.downloadtarfile = function (data) {
            return $http({
                method: 'POST',
                url: "/api/file/downDirBatch",
                data:JSON.stringify(data),
                dataType:"application/json"
            });
        };

        //上线支付页面（历史记录子页面）中显示该项目部署的tar包历史下载记录
        service.showdownloadhistoryrecords = function (data) {
            return $http({
                method: 'GET',
                url: "/api/online-delivery/chosedeploytarfile/showdownloadhistoryrecords",
                params: {"projectId":data.projectId}
            });
        };

        //上线支付页面（历史记录子页面）中显示该项目部署的tar包历史下载记录
        service.savedownloadhistoryrecords = function (data) {
            return $http({
                method: 'POST',
                url: "/api/onlinedelivery/downloadrecord/save",
                data:JSON.stringify(data),
                dataType:"application/json"
            });
        };

        service.getProductForDown = function (data) {
            return $http({
                method: 'GET',
                url: "/api/util/productfordown",
                params: {"projectId":data.projectId}
            });
        };
        return service;

    }]);